package hu.elte.inf.holiuml.coordgeom;

import java.awt.Point;

/**
 * Represents a point with two coordinates.
 * 
 * It is an immutable object (as opposed to java.awt.Point).
 * @author Csaba Hoch
 */
public class CGPoint {
	
	private int x;
	private int y;

	public CGPoint(int x, int y) {
		this.x = x;
		this.y = y;
	}
	
	public CGPoint(Point p) {
		this.x = p.x;
		this.y = p.y;		
	}
	
	public int getX() {
		return x;
	}
	
	public int getY() {
		return y;
	}
	
	public Point createPoint() {
		return new Point(x,y);
	}
	
	public CGPoint addVector(CGVector v) {
		return new CGPoint(x+v.getX(), y+v.getY());
	}
	
	public String toString() {
		return "("+x+","+y+")";
	}
}
